<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ChangeGoodsTableEngineToInnodb extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::dropIfExists('goods');
        Schema::create('goods', function (Blueprint $table) {
            $table->engine = 'innoDb';
            $table->increments('goods_id');
            $table->string('goods_name')->comment('商品名称');
            $table->integer('cat_id')->comment('goods_cat表的外键 分类id');
            $table->float('price',9,1)->nullable()->comment('商品的原价');
            $table->float('discount_price',9,1)->nullable()->comment('商品的现价或者打折价');
            $table->float('sales_num',9,1)->comment('商品销量')->default(0);
            $table->float('stock',9,1)->comment('库存量')->default(0);
            $table->string('image')->nullable()->comment('商品主图');
            $table->string('ship_address')->nullable()->comment('商品发货地');
            $table->tinyInteger('marketable')->default(0)->comment('上下架状态 0-下架 1-上架');
            $table->text('detail_content')->nullable()->comment('商品详情介绍 富文本编辑内容');
            $table->tinyInteger('disabled')->default(0)->comment('删除状态 0-未删除 1-已删除');
            $table->integer('sort')->default(0)->comment('商品排序的序号');
            $table -> string('bn')->nullable()->comment('商品编码');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {

    }
}
